x

Git

Check the remote URL

git remote -v

View full commit history with stats

git log --all --stat

List all commits

git log --oneline --graph --all

View full commit diff

git show <commit_hash>

List all branches

git branch -a

View full file history

git log -- <filename>

Search all commits

git log -S 'password'

Recursively search commits

git grep -i 'password'

Undo last commit

git reset --soft HEAD~1

Unstage all files

git reset

Find deleted files in commit history

git log --diff-filter=D --summary

List all files in all commits

git ls-tree -r HEAD

Recover deleted secrets from prior commits

git checkout <commit_hash>^ -- <path/to/file>

Access to git via ssh can be abused if there is an available git repo

GIT_SSH_COMMAND="ssh -i id_rsa -p 43022" git clone git@192.168.168.125:/git-server  

Set your name/email before making any commits:

git config --global user.name "kali" 
git config --global user.email "kali@kali.(none)"

Add all modified/new/deleted files in the current repo to the staging area:

git add -A

Make a local commit

git commit -m "pwn"

Push changes to the remote's master branch

GIT_SSH_COMMAND="ssh -i ../id_rsa -p 43022" git push origin master  
Left-click: follow link, Right-click: select node, Scroll: zoom
x